POV-Ray : Newsgroups : povray.newusers : Is there a "string length" function? : Re: Is there a "string length" function? Server Time
31 Jul 2024 08:19:08 EDT (-0400)
  Re: Is there a "string length" function?  
From: Warp
Date: 22 Feb 2003 07:16:15
Message: <3e576a0f@news.povray.org>
Christopher James Huff <cja### [at] earthlinknet> wrote:
> I see a bunch of categories that it doesn't fit in, and one that it 
> does. strlen() isn't a float function, it is a string function. 
> Categorizing by purpose makes much more sense.

  strlen() is a float function.

  There's a good and logical reason for calling it a float function (and
you should know it without me telling it).
  The reason for calling it a float function according to its return value
type is that it can be used anywhere a float is expected. In the same
way a vector function can be used anywhere a vector is expected.

  For example, in the definition of a sphere object the first parameter
is a vector. You can use a vector literal, a vector identifier or a
vector function there. The second parameter is a float. This means that
you can use a float literal, a float identifier or a float function there.
(Of course you can also use expressions which result in a float/vector or
can be promoted to it.)

  So naming and categorizing functions by their return value is not only
logical but it's actualy a categorization by purpose: Float functions are
those which can be used anywhere a float value is expected.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.